package com.xl.observer.weather;

/**
 * 1、是自身的状态和目标的状态发生改变
 */
public class ConcreateObserver implements WeatherObserver {

    private String observerName;

    private String weatherContent;

    private String tipMsg;

    @Override
    public void update(WeatherSubject subject) {
        weatherContent = ((ConcreateWeatherSubject) subject).getWeatherContent() + "push";
        System.out.println(observerName + " 收到了 " + weatherContent + " , " + tipMsg);

    }

    @Override
    public void update(String weatherContent) {
        this.weatherContent = weatherContent + " pull";
        System.out.println(observerName + " 收到了 " + this.weatherContent + " , " + tipMsg);
    }

    public String getObserverName() {
        return observerName;
    }

    public void setObserverName(String observerName) {
        this.observerName = observerName;
    }

    public String getWeatherContent() {
        return weatherContent;
    }

    public void setWeatherContent(String weatherContent) {
        this.weatherContent = weatherContent;
    }

    public String getTipMsg() {
        return tipMsg;
    }

    public void setTipMsg(String tipMsg) {
        this.tipMsg = tipMsg;
    }
}
